#include "ProxyManager.h"
#include "../../net/NCDefines.h"
#include "Global.h"

ProxyManager::ProxyManager()
{
	mUserProxy = UserProxy::getSingletonPtr();
	mItemProxy = ItemProxy::getSingletonPtr();
	mDungeonsProxy = DungeonsProxy::getSingletonPtr();
	_addObserver();
}

ProxyManager::~ProxyManager()
{
	RemoveObserver(this);
}

void ProxyManager::_addObserver()
{
	RegisterObserver(this, callfuncO_selector(ProxyManager::GameInit), kNCGameInit, NULL);
	RegisterObserver(this, callfuncO_selector(ProxyManager::GameLoad), kNCGameLoad, NULL);
	RegisterObserver(this, callfuncO_selector(ProxyManager::Regist), kNCRegist, NULL);
	RegisterObserver(this, callfuncO_selector(ProxyManager::GetInfo), kNCGetInfo, NULL);
	//AddObserver(this, callfuncO_selector(ProxyManager::DungeonExplor), kNCDungeonExplor, NULL);
	RegisterObserver(this, callfuncO_selector(ProxyManager::LoadEquipage), kNCLoadEquipage, NULL);
	RegisterObserver(this, callfuncO_selector(ProxyManager::SellEquipage), kNCSellEquipage, NULL);
	RegisterObserver(this, callfuncO_selector(ProxyManager::UnloadEquipage), kNCUnloadEquipage, NULL);
}

void ProxyManager::GameInit( CCObject* object )
{

}

void ProxyManager::GameLoad( CCObject* object )
{
    
}

void ProxyManager::Regist( CCObject* object )
{
//    NotificationObserver* notification = (NotificationObserver*)object;
//    PlayerInfo* playerInfo = ( PlayerInfo*)notification->getObject();
//    
//    mUserProxy->userVO.gid = playerInfo->checkInfo.gid;
//    mUserProxy->userVO.platform = playerInfo->checkInfo.platform;
//    
//    mUserProxy->userVO.name = playerInfo->baseInfo.name.c_str();
//    mUserProxy->userVO.exp = playerInfo->baseInfo.exp;
//    
//    mUserProxy->userVO.atkMin = playerInfo->battleInfo.attack;
//    mUserProxy->userVO.defMin = playerInfo->battleInfo.defense;
//    mUserProxy->userVO.life = playerInfo->battleInfo.life;
//    mUserProxy->userVO.coin = playerInfo->financeInfo.coin;
//    mUserProxy->userVO.money = playerInfo->financeInfo.money;
//    mUserProxy->userVO.level = playerInfo->baseInfo.level;
//    mUserProxy->userVO.strength = playerInfo->battleInfo.power;
//    mUserProxy->userVO.powerCur = playerInfo->baseInfo.energycur;
//    mUserProxy->userVO.powerMax = playerInfo->baseInfo.energymax;
//    mUserProxy->userVO.agility = playerInfo->battleInfo.speed;
//    mUserProxy->userVO.naili = playerInfo->battleInfo.stamina;
//    mUserProxy->userVO.proficiency = playerInfo->battleInfo.vigour;   

//	mDungeonsProxy->curTaskInfo = playerInfo->taskInfo.curList[0];
//	mDungeonsProxy->maxTaskInfo = playerInfo->taskInfo.maxList[0];
}

void ProxyManager::GetInfo( CCObject* object )
{

}

void ProxyManager::GetBagInfo( CCObject* object )
{

}

void ProxyManager::GetTaskInfo( CCObject* object )
{

}

void ProxyManager::DungeonExplor( CCObject* object )
{
	mDungeonsProxy->battleResult = *((BattleResult*)(object));
}

void ProxyManager::DistributePoint( CCObject* object )
{

}

void ProxyManager::ComposeEquipage( CCObject* object )
{

}

void ProxyManager::LoadEquipage( CCObject* object )
{

}

void ProxyManager::SellEquipage( CCObject* object )
{

}

void ProxyManager::UnloadEquipage( CCObject* object )
{
}
